<%@page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>Insert title here</title>
		
		<link rel="stylesheet" href="/MaoArvestiteNaitudeHaldamiseInfosysteem/static/css/ui/1.10.3/themes/smoothness/jquery-ui.css" />
		<script src="/MaoArvestiteNaitudeHaldamiseInfosysteem/static/js/jquery-1.9.1.js"></script>
		<script src="/MaoArvestiteNaitudeHaldamiseInfosysteem/static/js/ui/1.10.3/jquery-ui.js"></script>
		<script type="text/javascript" src="static/js/myJsMethods.js"></script>
		<script type="text/javascript" src="static/js/floatingTableHeader.js"></script>
		<link rel="stylesheet" href="/MaoArvestiteNaitudeHaldamiseInfosysteem/static/css/style.css" />
		
		<script>
			$(document).ready(function()
			{
				$( ".datepicker" ).datepicker();
				
			});
		</script>
		<style>
			table.tableWithFloatingHeader
			{
				font-family: verdana,arial,sans-serif;
				font-size:11px;
				color:#333333;
				border-width: 1px;
				border-color: #666666;
				border-collapse: collapse;
			}
			
			table.tableWithFloatingHeader th
			{
				border-width: 1px;
				padding: 8px;
				border-style: solid;
				border-color: #666666;
				background-color: #dedede;
				opacity:0.75;
				filter:alpha(opacity=40); /* For IE8 and earlier */
			}
			
			table.tableWithFloatingHeader td
			{
				border-width: 1px;
				padding: 8px;
				border-style: solid;
				border-color: #666666;
				background-color: #ffffff;
			}
			
			th {
			    border-width: 1px;
				padding: 8px;
				border-style: solid;
				border-color: #666666;
				background-color: #dedede;
				opacity:0.75;
				filter:alpha(opacity=40); /* For IE8 and earlier */
			}
			td {
				padding: 8px;
				border-style: solid;
				border-color: #666666;
				background-color: #ffffff;
			}
			
		</style>
	</head>
	<body>
	KÕIK ALAJAAMAD: <br/>
		<table class="tableWithFloatingHeader">
					<thead>
					<tr>
						<th>Alajaama nimi</th>
						<th>Sisestamise kuupäev</th>
						<th>Viimase muutmise kuupäev</th>
						<th></th>
						<th></th>
						<th></th>
					</tr>
					</thead>
					<tbody>
			<c:if test="${listOfSubstations != null && not empty listOfSubstations}">
				<c:forEach var="substation" items="${listOfSubstations}">
					<tr>
						<c:set var="ajaxSuccessFunctionName" value="\"showPotentialSubstationMainElectricityMetersConnectedWithSubstionAfterAjaxSuccess()\"" />
					
						<td><c:out value="${substation.substationName}" /></td>
						<td><c:out value="${substation.dateInserted}" /></td>
						<td><c:out value="${substation.dateUpdated}" /></td>
						<td id="potentialSubstationMainElectricityMetersConnectedRequestWithAJAX" style="color:blue">
							<div id="${substation.substationID}"></div>
							<button onclick="runAjaxShowingPotentialConnectedElectricityMetersWithSubstation(${substation.substationID})">
								Kuva alajaamaga ühenduses olevad peaarvestid
							</button>
							<!-- <button id="${substation.substationID}" onclick="fetchDataByID('/MaoArvestiteNaitudeHaldamiseInfosysteem/AJAXServices', ${ajaxSuccessFunctionName}, 'getSubstationMainElectricityMetersConnectedToSubstation', ${substation.substationID}, '#potentialSubstationMainElectricityMetersConnectedRequestWithAJAX')">
								Kuva alajaamaga ühenduses olevad peaarvestid
							</button> -->
						</td>
						<td>
							<form action="/MaoArvestiteNaitudeHaldamiseInfosysteem/FrontController?mode=administerSubstationsPage&submode=editSubstationPage" 
								method="post">
								<input type="hidden" name="substationIDToEditForm" value="${substation.substationID}">
								<input type="submit" name="submitEditSubstationSubstationID" value="Muuda">	
							</form>
						</td>
						<td>
							<form action="/MaoArvestiteNaitudeHaldamiseInfosysteem/FrontController?mode=administerSubstationsPage&submode=deleteSubstationPage" 
								method="post">
								<input type="hidden" name="substationIDToDelete" value="${substation.substationID}">
								<input type="submit" name="submitDeleteSubstationSubstationID" value="Kustuta">	
							</form>
						</td>
					</tr>
				</c:forEach>
			</c:if>
			</tbody>
		</table>
	</body>
</html>